package com.axxy.adapter;

/**
 * @author 一缕茜阳
 * @date 2021/8/9
 */
public class AdapterTest {
    public static void main(String[] args) {

        Socket socket = new Socket();
        Target target  = new Adapter(socket);
        target.request();
        target.supply();

    }
}
interface Target {
    void supply();
    void request();
}

class Socket {
    void specificSupply(){
        System.out.println("提供380V");
    }
}

class Adapter implements Target {

    Socket socket;

    public Adapter(Socket socket) {
        this.socket = socket;
    }

    @Override
    public void supply() {
        System.out.println("转换成220V");
    }

    @Override
    public void request() {
        socket.specificSupply();

    }
}



